#!/usr/bin/perl

use strict;
use warnings;
use Test::More 'no_plan';
#use Test::Lazy;

require_ok( 'methods.pm' );
use methods;

no strict 'refs';

foreach my $method qw(methods::split_up methods::for_each methods::methodical) {
	print "running method '$method'\n";
	ok(-1 == &$method(3, []));
	ok(-1 == &$method(3, [1]));
	ok(0 == &$method(1, [1]));
	#
	ok(0 == &$method(1, [1, 3, 5]));
	ok(1 == &$method(3, [1, 3, 5]));
	ok(2 == &$method(5, [1, 3, 5]));
	ok(-1 == &$method(0, [1, 3, 5]));
	ok(-1 == &$method(2, [1, 3, 5]));
	ok(-1 == &$method(4, [1, 3, 5]));
	ok(-1 == &$method(6, [1, 3, 5]));
	#
	ok(0 == &$method(1, [1, 3, 5, 7]));
	ok(1 == &$method(3, [1, 3, 5, 7]));
	ok(2 == &$method(5, [1, 3, 5, 7]));
	ok(3 == &$method(7, [1, 3, 5, 7]));
	ok(-1 == &$method(0, [1, 3, 5, 7]));
	ok(-1 == &$method(2, [1, 3, 5, 7]));
	ok(-1 == &$method(4, [1, 3, 5, 7]));
	ok(-1 == &$method(6, [1, 3, 5, 7]));
	ok(-1 == &$method(8, [1, 3, 5, 7]));
}

